(a) Where the writ is issued for the purpose of inquiring into the validity of any final administrative order or decision made as the result of a proceeding in which by law a hearing is required to be given, evidence is required to be taken, and discretion in the determination of facts is vested in the inferior tribunal, corporation, board, or officer, the case shall be heard by the court sitting without a jury. All or part of the record of the proceedings before the inferior tribunal, corporation, board, or officer may be filed with the petition, may be filed with respondent's points and authorities, or may be ordered to be filed by the court. Except when otherwise prescribed by statute, the cost of preparing the record shall be borne by the petitioner. Where the petitioner has proceeded pursuant to Section 68511.3 of the Government Code and the Rules of Court implementing that section and where the transcript is necessary to a proper review of the administrative proceedings, the cost of preparing the transcript shall be borne by the respondent. Where the party seeking the writ has proceeded pursuant to Section 1088.5, the administrative record shall be filed as expeditiously as possible, and may be filed with the petition, or by the respondent after payment of the costs by the petitioner, where required, or as otherwise directed by the court. If the expense of preparing all or any part of the record has been borne by the prevailing party, the expense shall be taxable as costs.
(b) The inquiry in such a case shall extend to the questions whether the respondent has proceeded without, or in excess of jurisdiction; whether there was a fair trial; and whether there was any prejudicial abuse of discretion. Abuse of discretion is established if the respondent has not proceeded in the manner required by law, the order or decision is not supported by the findings, or the findings are not supported by the evidence.
(c) Where it is claimed that the findings are not supported by the evidence, in cases in which the court is authorized by law to exercise its independent judgment on the evidence, abuse of discretion is established if the court determines that the findings are not supported by the weight of the evidence. In all other cases, abuse of discretion is established if the court determines that the findings are not supported by substantial evidence in the light of the whole record.
. . .
(e) Where the court finds that there is relevant evidence that, in the exercise of reasonable diligence, could not have been produced or that was improperly excluded at the hearing before respondent, it may enter judgment as provided in subdivision (f) remanding the case to be reconsidered in the light of that evidence; or, in cases in which the court is authorized by law to exercise its independent judgment on the evidence, the court may admit the evidence at the hearing on the writ without remanding the case.
(f) The court shall enter judgment either commanding respondent to set aside the order or decision, or denying the writ. Where the judgment commands that the order or decision be set aside, it may order the reconsideration of the case in the light of the court's opinion and judgment and may order respondent to take such further action as is specially enjoined upon it by law, but the judgment shall not limit or control in any way the discretion legally vested in the respondent.
(g) Except as provided in subdivision (h), the court in which proceedings under this section are instituted may stay the operation of the administrative order or decision pending the judgment of the court, or until the filing of a notice of appeal from the judgment or until the expiration of the time for filing the notice, whichever occurs first. However, no such stay shall be imposed or continued if the court is satisfied that it is against the public interest. The application for the stay shall be accompanied by proof of service of a copy of the application on the respondent. Service shall be made in the manner provided by Title 5 (commencing with Section 405) of Part 2 or Chapter 5 (commencing with Section 1010) of Title 14 of Part 2. If an appeal is taken from a denial of the writ, the order or decision of the agency shall not be stayed except upon the order of the court to which the appeal is taken. However, in cases where a stay is in effect at the time of filing the notice of appeal, the stay shall be continued by operation of law for a period of 20 days from the filing of the notice. If an appeal is taken from the granting of the writ, the order or decision of the agency is stayed pending the determination of the appeal unless the court to which the appeal is taken shall otherwise order. Where any final administrative order or decision is the subject of proceedings under this section, if the petition shall have been filed while the penalty imposed is in full force and effect, the determination shall not be considered to have become moot in cases where the penalty imposed by the administrative agency has been completed or complied with during the pendency of the proceedings.
(h)
. . .